package mb.klient.webbean;

import java.util.ArrayList;

import javax.faces.model.SelectItem;

import mb.klient.dao.SendedHistoryDAO;
import mb.klient.data.SendedHistoryData;


/**
 * Manager obsługujący widok historii paczek
 * @author Michał Budziło
 *
 */
public class SendedHistoryManager {
	private SendedHistoryDAO dao;
	private ArrayList<SendedHistoryData> dataList;
	private SendedHistoryData editedData;
	private ArrayList<SelectItem> statusList;
	
	/**
	 * Konstruktor
	 */
	public SendedHistoryManager()
	{
		dataList = new ArrayList<SendedHistoryData>();
		dao = new SendedHistoryDAO();
		dataList = dao.getSendedHistoryDataList();

	}
	
	/**
	 * Metoda pobiera z bazy danych listę wysłanych paczek
	 */
	public void refreshData()
	{
		dataList = dao.getSendedHistoryDataList();
		
	}
	
	/**
	 * Metoda usuwa z bazy danych paczkę ( hisoria paczek )
	 */
	public void deleteData()
	{
		 dao.deleteData(editedData.getIdentPaczki());

	}

	/**
	 * @return the dataList
	 */
	public ArrayList<SendedHistoryData> getDataList() {
		return dataList;
	}

	/**
	 * @param dataList the dataList to set
	 */
	public void setDataList(ArrayList<SendedHistoryData> dataList) {
		this.dataList = dataList;
	}

	/**
	 * @return the editedData
	 */
	public SendedHistoryData getEditedData() {
		return editedData;
	}

	/**
	 * @param editedData the editedData to set
	 */
	public void setEditedData(SendedHistoryData editedData) {
		this.editedData = editedData;
	}

	
}
